<me:UIKD x:Class="WPFExcelReport.TKDBOX"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                    xmlns:SP="clr-namespace:WPFExcelReport;assembly=TKDANSP"  
                    xmlns:KR="clr-namespace:WPFExcelReport;assembly=TKUNDADR" 
                    xmlns:KV="clr-namespace:WPFExcelReport;assembly=TKUNDVER" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                     FontSize="14"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIKD.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIKD.Resources>
    <StackPanel  >
        <WrapPanel Margin="0,5,0,0">
            <Grid Margin="10,0,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=编号:}}"></TextBlock>
                <TextBlock    Grid.Column="1" Text="{Binding KDKUNDNR,Source={StaticResource vwMaster}}" Width="80"/>
            </Grid>
            <WrapPanel Visibility="{Binding KDBLOCK,ElementName=TV,Converter={StaticResource bv}}">
                <TextBlock Foreground="Red" FontSize="18"  
                       Text="{Binding Source={Localization:Translate Word=已经超出信用额度，客户锁定}}"  Margin="10,0,0,0"></TextBlock>
                <TextBlock   Margin="10,0,0,0" Text="{Binding VKBLOCK,ElementName=TV}" Width="80"/>
            </WrapPanel>  
            <Grid Margin="10,0,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=客户简称:}}"></TextBlock>
                <ex:TXT72  IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" 
                               MaxLength="8" Grid.Column="1" CharacterCasing="Upper"  
                               Text="{Binding KDKUNDNA, Converter={StaticResource gb2312},Source={StaticResource vwMaster}}" Width="100" />
            </Grid>
            <Grid Margin="10,0,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=品牌名称:}}"></TextBlock>
                <ex:TXT72   IsAutoClear="false"  
                                IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"  
                                MaxLength="15" Grid.Column="1" CharacterCasing="Upper"   
                                Text="{Binding KDKNAME, Converter={StaticResource gb2312},Source={StaticResource vwMaster}}" Width="150" />
            </Grid>
        </WrapPanel>
        <WrapPanel Margin="0,5,0,0">
            <Grid Margin="10,0,0,0" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=国家:}}"></TextBlock>
                <SD:TSSD0150 Grid.Column="1" 
                             IsEdit="{Binding IsEdit,ElementName=TV}"
                             KEY="{Binding KDLAND,ElementName=TV}"
                             ORDERNUM="{Binding KDLAND,ElementName=TV}"
                             />
            </Grid> 
            <KV:TKD06 STEUER="{Binding REGMWST,ElementName=TV}"
                      ORDERNUM="{Binding KVKEY,ElementName=TV}"
                      IsAuto="True"
                       IsEdit="{Binding IsEdit,ElementName=TV}"
                       IsSaved="{Binding IsSaved,ElementName=TV}" 
                      />
            <Grid Margin="10,0,0,0" Visibility="Collapsed">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=总公司编号:}}"></TextBlock>
                <me:TSKD02 Grid.Column="1"  KEY="{Binding KDZENTR,Source={StaticResource vwMaster}}" />
            </Grid>
        </WrapPanel>
        <KR:TKD05
                Background="LightYellow"
               ORDERNUM="{Binding  KD15KEY,ElementName=TV}"
               KUNDNR="{Binding KEY,ElementName=TV}"
               KDANAME1="{Binding  KDNAME1,ElementName=TV}"
               KDANAME2="{Binding  KDNAME2,ElementName=TV}"
               KDASTRASSE1="{Binding  KDSTRASSE1,ElementName=TV}"
               KDASTRASSE2="{Binding  KDSTRASSE2,ElementName=TV}"
               KDAPOSTFACH="{Binding  KDPOSTFACH,ElementName=TV}"
               KDATEL="{Binding  KDTEL,ElementName=TV}"
               KDATTEX="{Binding  KDTTEX,ElementName=TV}"
               KDAFAX="{Binding  KDFAX,ElementName=TV}"
              IsAuto="True"
              KDAADRSL="VK"
              IsSaved="{Binding  IsSaved,ElementName=TV}"
              IsEdit="{Binding  IsEdit,ElementName=TV}"
            /> 
      
        <WrapPanel Margin="0,5,0,0">
            <Grid Margin="10,0,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=信用额度:}}"></TextBlock>
                <ex:NumericBox  IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"  
                                    Grid.Column="1"  
                                    Maximum="999999999"
                                Text="{Binding KDKREDLIM1}"  Width="100" />
            </Grid>
            <WrapPanel>
                <TextBlock  Margin="10,0,0,0"  Text="{Binding Source={Localization:Translate Word=已付款(千):}}"></TextBlock>
                <TextBlock  Margin="10,0,0,0"  Text="{Binding 已付款,ElementName=TV}"  Width="80" />
                <TextBlock  Margin="10,0,0,0"  Text="{Binding Source={Localization:Translate Word=待付款:}}"></TextBlock>
                <TextBlock  Margin="10,0,0,0"  Text="{Binding  已开票,ElementName=TV}"  Width="80" />
                <TextBlock  Margin="10,0,0,0"  Text="{Binding Source={Localization:Translate Word=现金:}}"></TextBlock>
                <TextBlock  Margin="10,0,0,0"  Text="{Binding  待处理现金,ElementName=TV}"  Width="80" />            
                <TextBlock  Margin="10,0,0,0"  Text="{Binding Source={Localization:Translate Word=待支付费:}}"></TextBlock>
                <TextBlock   Margin="10,0,0,0" Text="{Binding SWING,ElementName=TV}"  Width="80" />
                <TextBlock   Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=信用:}}"></TextBlock>
                <TextBlock  Margin="10,0,0,0"  Text="{Binding CREDIT,ElementName=TV}"  Width="80" /> 
            </WrapPanel>
            <Button Content="{Binding Source={Localization:Translate Word=发票明细}}" Margin="10,0,0,0" Click="VR02Command"/>
            <Button Content="{Binding Source={Localization:Translate Word=销售单明细}}" Margin="10,0,0,0"  Click="VK02Command"/>
        </WrapPanel>
    </StackPanel>
</me:UIKD>
